# coding=utf-8
from gevent import monkey
import sys

from app import create_app

# monkey.patch_all()
application = create_app(flask_config = 'development')

reload(sys)
sys.setdefaultencoding('utf8')

from app.modules.status.models import Status
from app.modules.status import STATUS

with application.app_context():
    _list = Status.query.all()
    for _status in _list:
        STATUS[_status.status] = _status.desc

if __name__ == "__main__":
    if application.config['socketio_app']:
        socketio_app = application.config['socketio_app']
        socketio_app.run(app = application, host = '0.0.0.0', port = 5003, debug = False)
    else:
        # application.run(host = '0.0.0.0', port = 5003, debug = False, threaded = True)
        application.run(host = '0.0.0.0', port = 5003, debug = False)
